import Mock from 'mockjs'

/*
 es6
  let 变量
  const 常量
* */
/*
  1. 生成模拟数据
* */
let current = Mock.mock({
  'id': 1,
  'username': 'admin',
  'password': '123'
})


let employees = Mock.mock({
  "list|5": [{
    "id|+1": 1,
    "name": "@cname",
    "dept|1": [
      {
        id: 1,
        title: 'HR'
      }, {
        id: 2,
        title: "DEV"
      }
    ],
    "title|1": [
      {
        id: 1,
        title: "职员"
      }, {
        id: 2,
        title: "经理"
      }
    ],
    "super|1": [
      {
        id: 1,
        name: "Z"
      }, {
        id: 2,
        name: "L"
      }
    ]
  }]
})

/**
 *  2. 生成ajax拦截规则
 * */
Mock.mock('http://test.org/emp/login', 'get', current);
Mock.mock('http://test.org/emp/list', 'get', employees.list);

